/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cubelabs.nexus.controller;

import cubelabs.nexus.entity.GuideInfo;
import cubelabs.nexus.entity.User;
import cubelabs.nexus.service.GuideService;
import cubelabs.nexus.service.NexusService;
import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author chaitanya
 */
@Controller
public class ProfileController {
	
	@Autowired
	private GuideService guideService;
	
	@Autowired
	private NexusService nexusService;
	
	@RequestMapping(value="/gprofile")
	public ModelAndView getGuidingCapabilities(@ModelAttribute("userId") long userId){
		ModelAndView mv = new ModelAndView("gprofile");
		mv.addObject("cap",guideService.findAllCapbilities(userId));
		mv.addObject("profile", nexusService.findProfile(userId));
		//mv.addObject(guideService)
		return mv;
	}
	
	@RequestMapping(value="/myprofile")
	public ModelAndView getMyProfile(HttpSession session){
		ModelAndView mv = new ModelAndView("myprofile");
		User user = (User)session.getAttribute("user");
		mv.addObject("cap",guideService.findAllCapbilities(user.getId()));
		mv.addObject("profile", nexusService.findProfile(user.getId()));
		//mv.addObject(guideService)
		return mv;
	}
	
}
